﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 依赖综合案例.ConfigServices;
using 依赖综合案例.LogServices;

namespace 依赖综合案例.MailServices
{
    internal class ConsoleMailProjects : IMailProjects
    {
        public readonly ILogProvider log;

        /*
        public readonly IConfigProjects config;

        public ConsoleMailProjects(ILogProvider log, IConfigProjects config)
        {
            this.log = log;
            this.config = config;
        }
        public void Send(string title, string to, string body)
        {
            this.log.LogInfo("begin send Mail");
            string stmpServer = this.iconfigReader.GetValue("StempServer");
            string stmpUserName = this.config.GetValue("UserName");
            string stmpPwd = this.config.GetValue("PassWord");
            Console.WriteLine($"邮件服务地址：{stmpServer},{stmpUserName},{stmpPwd}");
            Console.WriteLine($"真发邮件了,{title},{to},{body}");
            this.log.LogInfo("send Mail over");
        }
    }
        */

        public readonly IconfigReader iconfigReader;
        public ConsoleMailProjects(ILogProvider log, IconfigReader iconfigReader)
        {
            this.log = log;
            this.iconfigReader = iconfigReader;
        }

        public void Send(string title, string to, string body)
        {
            this.log.LogInfo("begin send Mail");
            string stmpServer = this.iconfigReader.GetValue("StempServer");
            string stmpUserName = this.iconfigReader.GetValue("UserName");
            string stmpPwd = this.iconfigReader.GetValue("PassWord");
            Console.WriteLine($"邮件服务地址：{stmpServer},{stmpUserName},{stmpPwd}");
            Console.WriteLine($"真发邮件了,{title},{to},{body}");
            this.log.LogInfo("send Mail over");
        }
    }
}
